﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using EvidenceManagement.Data.Common;
using Microsoft.Practices.Unity;

namespace EvidenceManagement.Data
{
    public class EvidenceManagementDataAccessor : BaseDataAccessor
    {
        #region Fields

        #endregion

        #region Constructor

        public EvidenceManagementDataAccessor()
        {
        }

        public EvidenceManagementDataAccessor(string connectionKey)
            : base(connectionKey)
        {

        }

        #endregion

        public string GetConfigValue(string configKey)
        {
            using (var command = DataRepository.CreateCommand(System.Data.CommandType.StoredProcedure
                , StoredProcedures.GetApplicationConfigValue))
            {
                DataRepository.AddCommandParameter(command, "ConfigKey", System.Data.DbType.String, configKey);
                return ConversionHelper.GetString(DataRepository.ExecuteScalar(command));
            }
        }
    }
}
